#ifndef _GSTACK_H_
#define _GSTACK_H_

#include <vector>

template<typename T>
class BBStack
{
public:
	BBStack(void){}
	~BBStack(void)
	{
		elems.clear();
	}
	void push(T obj);
	int size();
	bool isEmpty();
	T pop();
	T top() const;
private:
	std::vector<T> elems;
};


template<typename T>
void BBStack<T>::push( T obj )
{
	elems.push_back(obj);
}

template<typename T>
T BBStack<T>::pop()
{
	if(isEmpty())
		return NULL;
	T ele = elems.back();
	elems.pop_back();
	return ele;
}

template<typename T>
bool BBStack<T>::isEmpty()
{
	return elems.empty();
}

template<typename T>
int BBStack<T>::size()
{
	return elems.size();
}

template<typename T>
T BBStack<T>::top() const
{
	return elems.back();
}	


#endif _GSTACK_H_